home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Complementary Applications 2004 February / SGI IRIX 6.5 Complementary Applications 2004 February.iso / dist / cde.idb / usr / dt / share / examples / dtksh / XdrawTest.z / XdrawTest
Encoding:
Text File  |  2003-11-18  |  5.0 KB  |  139 lines

  1. #! /usr/dt/bin/dtksh
  2. #
  3. # XdrawTest
  4. #
  5. # Copyright 2000, Silicon Graphics, Inc.
  6. # ALL RIGHTS RESERVED
  7. # UNPUBLISHED -- Rights reserved under the copyright laws of the United
  8. # States.   Use of a copyright notice is precautionary only and does not
  9. # imply publication or disclosure.
  10. #
  11. # U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
  12. # Use, duplication or disclosure by the Government is subject to restrictions
  13. # as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
  14. # in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
  15. # in similar or successor clauses in the FAR, or the DOD or NASA FAR
  16. # Supplement.  Contractor/manufacturer is Silicon Graphics, Inc.,
  17. # 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
  18. #
  19. # THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
  20. # INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
  21. # DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
  22. # PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
  23. # GRAPHICS, INC.
  24. #
  25. ##########################################################################
  26. #  (c) Copyright 1993, 1994 Hewlett-Packard Company    
  27. #  (c) Copyright 1993, 1994 International Business Machines Corp.
  28. #  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  29. #  (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
  30. #      Novell, Inc.
  31. ##########################################################################
  32.  
  33.  
  34. #
  35. # This sample shell script demonstrates the calling sequence for most of
  36. # the X drawing commands.
  37. #
  38.  
  39. ExposeCallback()
  40. {
  41.    XDrawRectangle $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  42.                  10 20 100 200 \
  43.                              120 20 200 100
  44.  
  45.    XFillRectangle $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  46.                               -foreground red -background green 20 30 80 180 
  47.  
  48.    XClearArea $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  49.                               30 40 60 40 false
  50.  
  51.    XDrawLine $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  52.                               -foreground red -background white 130 22 130 117
  53.  
  54.    XDrawLines $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  55.                               140 30 140 101 \
  56.                               150 101 150 30
  57.  
  58.    XDrawLines $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  59.                               -CoordModePrevious -line_width 3 160 30 0 71 \
  60.                               10 0 0 -71
  61.  
  62.    XDrawPoint $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  63.                               180 30 180 101
  64.  
  65.    XDrawPoints $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  66.     190 30 190 40 190 50 190 60 190 70 190 80 190 90 190 101
  67.  
  68.    XDrawPoints $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  69.                               -CoordModePrevious \
  70.                           200 30 0 10 0 10 0 10 0 10 0 10 0 10 0 10
  71.  
  72.    XDrawSegments $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  73.                     -function clear -foreground green -background red \
  74.                     -line_width 3 \
  75.                 210 30 210 40 210 50 210 60 210 70 210 80 210 90 210 100
  76.  
  77.    XDrawArc $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  78.                      -line_width 3 20 300 100 150 300 5760
  79.  
  80.    XFillArc $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  81.                      -line_width 3 20 270 100 150 11520 5760
  82.  
  83.    XDrawString $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  84.                      -font fixed -foreground blue -background red 200 200 \
  85.                      "XDrawString" 
  86.  
  87.    XDrawImageString $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  88.                      -foreground green -background red 200 250 \
  89.                      "XDrawImageString" 
  90.  
  91.    XFillPolygon $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
  92.                      -Convex -CoordModePrevious \
  93.                  300 300 30 70 30 -140
  94.  
  95.    XTextWidth "-" fixed "Hi Mom"
  96. }
  97.  
  98. ClearWindow()
  99. {
  100.    XClearWindow $(XtDisplay "-" $DRAWINGAREA) $(XtWindow "-" $DRAWINGAREA)
  101. }
  102.  
  103.  
  104. ######################### Create the Main UI #################################
  105.  
  106. XtInitialize TOPLEVEL drawingArea DrawingArea "$0" "$@"
  107.  
  108. XtCreateManagedWidget FORM form XmForm $TOPLEVEL
  109.  
  110. XtCreateManagedWidget DRAWINGAREA drawingArea XmDrawingArea $FORM \
  111.     topAttachment:ATTACH_FORM \
  112.     leftAttachment:ATTACH_FORM \
  113.     rightAttachment:ATTACH_FORM
  114. XtAddCallback $DRAWINGAREA exposeCallback ExposeCallback
  115.  
  116. XtCreateManagedWidget SEP sep XmSeparator $FORM \
  117.     topAttachment:ATTACH_WIDGET \
  118.     topWidget:$DRAWINGAREA \
  119.     leftAttachment:ATTACH_FORM \
  120.     rightAttachment:ATTACH_FORM
  121.  
  122. XtCreateManagedWidget PB pb XmPushButton $FORM \
  123.     labelString:"Clear The Window" \
  124.     topAttachment:ATTACH_WIDGET \
  125.     topWidget:$SEP \
  126.     leftAttachment:ATTACH_FORM \
  127.     rightAttachment:ATTACH_FORM \
  128.     bottomAttachment:ATTACH_FORM
  129. XtAddCallback $PB activateCallback ClearWindow
  130.  
  131. XtSetValues $DRAWINGAREA \
  132.          height:450 \
  133.          width:450
  134.  
  135. XtRealizeWidget $TOPLEVEL
  136.  
  137. XtMainLoop
  138.